package com.hx.vending.controller;

import com.hx.vending.bean.Apk;
import com.hx.vending.service.IApkService;
import com.hx.vending.util.Msg;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2019/4/8.
 */
@Controller
@RequestMapping("/apk")
public class ApkController {


    @Resource
    private IApkService apkService;


    /**
     * 保存apk信息
     * @param apk
     * @return
     */
    @RequestMapping("/insertApk")
    @ResponseBody
    public Msg insertApk(Apk apk) {
        return this.apkService.insertApk(apk);
    }


    /**
     * 删除apk信息
     * @param apkIds    1-2-3  id
     * @return
     */
    @RequestMapping(value = "/deleteApk", method = RequestMethod.DELETE)
    @ResponseBody
    public Msg deleteApk(String apkIds) {
        return this.apkService.deleteApk(apkIds);
    }


    /**
     * 修改apk信息
     * @param apk
     * @return
     */
    @RequestMapping("/updateApk")
    @ResponseBody
    public Msg updateApk(Apk apk) {
        return this.apkService.updateApk(apk);
    }


    /**
     * 查询所有apk文件信息
     * @param apk
     * @return
     */
    @RequestMapping("/selectAllApkMessage")
    @ResponseBody
    public Msg selectAllApkMessage(Apk apk, @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize, @RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum) {
        return this.apkService.selectAllApkMessage(apk, pageSize, pageNum);
    }




}
